import { useFetchPost } from '~/composables/useHttp/useFetch'
import { useFetchRefPost } from '~/composables/useHttp/useFetchRef'

/**
 * 文章评论列表
 */
export const articleCommentApi = (p = 1, articleId: string) => {
    return useFetchRefPost<ArticleCommentVo>('articleCommentApi', '/comment/list', {
        body: { pageNum: p, articleId: articleId }
    })
}
/**
 * 查看更多
 */
export const moreCommentApi = (p = 1, articleId: string, commentMid: string) => {
    return useFetchPost<ArticleCommentVo>('moreCommentApi', '/comment/mores', {
        body: { pageNum: p, articleId: articleId, mid: commentMid, pageSize: 3 }
    })
}
/**
 * 添加评论
 */
export const commentSaveApi = <T>(body: T) => {
    return useFetchPost<R<T>>('commentSaveApi', '/comment/save', {
        body: body!
    })
}
/**
 * 评论点赞
 */
export const commentLikeApi = <T>(commentId: string) => {
    return useFetchPost<R<T>>('commentShieldApi', `/comment/like/${commentId}`)
}